package com.bjwl.base;

public class Result {
	private String message; //消息
	private boolean success;//false失败，true成功
	private Object data;//携带数据
	private boolean isLoginSign;//用户是否登录
	//写构造函数
	public Result( boolean success,String message, Object data) {
		super();
		this.success = success;
		this.message = message;
		this.data = data;
		this.isLoginSign=true; //已登录
	}
	
	public Result() {
		//默认为未登录，
		this.isLoginSign = false;
	}
	//未登录的方法
	public static Result unLogin() {
		return new Result();
	}

	/**
	 * 成功的方法
	 * @return
	 */
	public static Result success(String message,Object data) {
		return new Result(true, message, data);
	}
	public static Result success(String message) {
		return new Result(true, message,null);
	}
	public static Result success(Object data) {
		return new Result(true, null, data);
	}
	/**
	 * 失败的方法
	 * @return
	 */
	public static Result fail(String message,Object data) {
		return new Result(false, message, data);
	}
	public static Result fail(String message) {
		return new Result(false, message, null);
	}
	public static Result fail(Object data) {
		return new Result(true, null, data);
	}
	
	//生成get，set方法，不然会报错 （No converter found for return value of type: class com.bjwl.base.Result）
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public boolean isSuccess() {
		return success;
	}
	public void setSuccess(boolean success) {
		this.success = success;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	public boolean isLogin() {
		return isLoginSign;
	}
	public void setLogin(boolean isLogin) {
		this.isLoginSign = isLogin;
	}
	
	
	
	
	
	

}
